﻿@model IEnumerable<EC_ASS.Models.ShopItem>

@if (Model.Count() > 0)
{
    <a class="dropdown-toggle" id="drop4" role="button" data-toggle="dropdown" href="#"><i class="icon-shopping-cart"> @Model.Count() món hàng</i><b class="caret"></b></a>
    <ul id="menu1" class="dropdown-menu" role="menu" aria-labelledby="drop4">
        <li role="presentation">
            <table class="table table-condensed" style="width: 350px;">
                <thead>
                    <th>Ảnh</th>
                    <th>Tên</th>
                    <th>Size</th>
                    <th>SL</th>
                    <th>Giá</th>
                    <th></th>
                </thead>
                <tbody>
                    @foreach (var item in Model)
                    {
                        <tr>
                            <td>
                                <img class="img-rounded" src="@Url.Content("~/" + item.cPicture)" style="height: 70px; width: 70px;" />
                            </td>
                            <td>@item.cName</td>
                            <td>@item.cSize</td>
                            <td>@item.cQuantity</td>
                            <td>@item.cPrice</td>
                            <td style="width: 40px; text-align: right;">
                                @Ajax.ActionLink("Xóa", "_RemoveShoppingCartItem", "Product", item, new AjaxOptions
                               {
                                   UpdateTargetId = "shoppingCart",
                                   HttpMethod = "GET",
                                   InsertionMode = InsertionMode.Replace
                               }, new {@class="btn btn-small", @onclick ="OnSuccess()" })
                            </td>
                        </tr>
                    }
                    <tr>
                        <td colspan="3">
                            <input style="margin-top: 20px;" class="btn btn-primary btn-small" type="button" value="Đặt hàng" onclick="javascript: window.location.href = '/Product/CheckOut';" />
                        </td>
                        <td><p style="margin-top: 20px;">Total: </p></td>
                        <td colspan="2"><p style="margin-top: 20px;">@ViewBag.Total VNĐ</p></td>
                    </tr>
                </tbody>
            </table>
        </li>
    </ul>
    
}
else
{
    <a class="dropdown-toggle" id="drop3" role="button" data-toggle="dropdown" href="#"><i class="icon-shopping-cart"> Giỏ hàng</i><b class="caret"></b></a>
    <ul id="menu2" class="dropdown-menu" role="menu" aria-labelledby="drop3">
        <li role="presentation">
            <div class="span3 alert alert-warning" style="margin-right: 20px;">Chưa có sản phẩm.</div>
        </li>
    </ul>

}
<script>
    function goToBuyPage() {
        window.location = "/Product/Buy/";
    }
</script>
